package com.mceil.mceilbase.activity;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;

import com.hjq.bar.TitleBar;
import com.mceil.mceilbase.R;
import com.mceil.mceilbase.adapter.AddAdapter;
import com.mceil.mceilbase.bean.AddBean;
import com.mceil.mylibrary.annotation.ContentView;
import com.mceil.mylibrary.annotation.ViewInject;
import com.mceil.mylibrary.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

@ContentView(R.layout.activity_add)
public class AddActivity extends BaseActivity {
    @ViewInject(R.id.toolbar)
    TitleBar toolBar;

    @ViewInject(R.id.recycler_view)
    RecyclerView recyclerView;


    @Override
    protected void initPreferences() {

    }

    @Override
    protected void initView() {
        toolBar.setTitle("加法练习");
    }

    @Override
    protected void initData() {
        List<AddBean> mDatas= new ArrayList<>();

        for (int i = 1; i < 11; i++) {
            mDatas.add(new AddBean(i,   ((int) ((Math.random() * 9 + 1) * 100)),1,   ((int) ((Math.random() * 9 + 1) * 100))));
        }

        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));

        AddAdapter adapter = new AddAdapter(R.layout.item_topic,mDatas);
        recyclerView.setAdapter(adapter);
    }
}
